let vm = new Vue({
    el:'#app',  //选中整个main
    data:{
        article:{
            publishRealName:'',
            userId:'',
            browseCount:0
        },//初始化对象     vue建议声明对象同时进行初始化，避免undefinded

    },
    methods:{
        //添加文章
        addArticle:function(){
            var user = JSON.parse(sessionStorage.getItem("user"));
            this.article.publishRealName=user.realName;
            this.article.userId=user.id;
            axios.post(
                'article/addArticle',
                this.article
            ).then(result=>{
                layer.msg(result.data.msg);
                location.href='html/article.html'
            }).catch(error=>{
                layer.msg(error.message);
            });
        }
    },
});